package br.edu.unipampa.util;

import java.text.DecimalFormat;
import java.util.Calendar;

/**
 *
 * @author aLeX
 */
public class DataHora {

    public String dia, mes, ano, diaSemana, dataCompleta = new String();
    public String hora, minuto, segundo, horaCompleta = new String();
    String diaSemanaExtenso[] = {"Domingo", "Segunda-Feira", "Terça-Feira", "Quarta-Feira",
        "Quinta-Feira", "Sexta-Feira", "Sábado"};

    DecimalFormat formatFloat = new DecimalFormat("00");
    Calendar dataAtual = Calendar.getInstance();

    public String leDataHora() {
        return leData() + " " + leHora();
    }

    private String leData() {
        dia = "" + formatFloat.format(dataAtual.get(dataAtual.DAY_OF_MONTH));
        mes = "" + formatFloat.format(dataAtual.get(dataAtual.MONTH) + 1);
        ano = "" + dataAtual.get(dataAtual.YEAR);
        diaSemana = "" + diaSemanaExtenso[dataAtual.get(dataAtual.DAY_OF_WEEK) - 1];
        dataCompleta = dia + "/" + mes + "/" + ano;
        return dataCompleta;
    }

    private String leHora() {
        hora = "" + formatFloat.format(dataAtual.get(dataAtual.HOUR_OF_DAY));
        minuto = "" + formatFloat.format(dataAtual.get(dataAtual.MINUTE));
        segundo = "" + formatFloat.format(dataAtual.get(dataAtual.SECOND));
        horaCompleta = hora + ":" + minuto + ":" + segundo;
        return horaCompleta;
    }

}
